Skip to content

fix: address zizmor security audit findings with auto-fix in GitHub workflows - #2824

Open
Venkaiahbabuneelam wants to merge 2 commits into
googleapis:mainfrom
Venkaiahbabuneelam:zizmor-autofix
Open

fix: address zizmor security audit findings with auto-fix in GitHub workflows#2824
Venkaiahbabuneelam wants to merge 2 commits into
googleapis:mainfrom
Venkaiahbabuneelam:zizmor-autofix

Conversation

@Venkaiahbabuneelam

Copy link
Copy Markdown

Overview

This PR addresses security findings identified by zizmor static analysis in GitHub Actions workflows.


🛡️ What Was Changed and Why?

1. Pinned GitHub Actions to Full Commit SHAs (unpinned-uses)

  • What changed: Replaced mutable version tags (e.g., @v4, @v5, @v8, @v10) with immutable 40-character commit hashes for all external actions across workflows (actions/checkout, actions/setup-python, actions/stale, and actions/github-script), preserving version tags as comments.
  • Why: Version tags in Git are mutable and can be modified or compromised upstream. Pinning to an exact commit SHA guarantees that workflows execute verified, tamper-proof code and protects against supply-chain attacks.

2. Restricted Credential Persistence (artipacked)

  • What changed: Configured persist-credentials: false on actions/checkout across read-only workflow jobs (import.yml and mypy.yml).
  • Why: By default, actions/checkout writes runner GITHUB_TOKEN credentials to local disk (.git/config). Disabling credential persistence prevents token exfiltration or artifact poisoning if build scripts or downstream dependencies are compromised.

3. Configured Least-Privilege Permissions (excessive-permissions)

  • What changed: Added explicit permissions: contents: read blocks across read-only jobs (import.yml and mypy.yml).
  • Why: Prevents jobs from inheriting default elevated repository write permissions when only read access to source code is needed.

📊 Modified Files Summary

File Changes Made Purpose
.github/workflows/import.yml Pinned checkout & setup-python SHAs + persist-credentials: false + permissions: contents: read Secure import test matrix execution
.github/workflows/mypy.yml Pinned checkout & setup-python SHAs + persist-credentials: false + permissions: contents: read Secure type checking execution
.github/workflows/stale.yml Pinned actions/stale to exact commit SHA Lock down automated stale issue/PR bot
.github/workflows/google-contributor-stale.yml Pinned actions/stale to exact commit SHA Lock down contributor stale bot
.github/workflows/block_major_releases.yml Pinned actions/github-script to exact commit SHA Secure major release guard workflow

📈 Zizmor Audit Results Comparison

  • Before Fix: 29 findings (7 High, 4 Medium, 18 Suppressed)
  • After Fix: 20 findings (0 High, 0 Medium, 18 Suppressed) (with manual permission additions)
  • Summary: Successfully resolved all 7 High-severity unpinned-uses findings, Low-severity artipacked findings, and 2 Medium-severity excessive-permissions findings across 5 workflow files.

✅ Verification & Safety

  • No runtime logic changes: No Python source code, package dependencies, or SDK public API surfaces were modified.
  • Exact version match: Pinned commit SHAs correspond directly to the official release versions already in use.
  • CI continuity: All existing pipeline triggers, pytest runs, and mypy checks continue to function normally.

@Venkaiahbabuneelam Venkaiahbabuneelam self-assigned this Aug 17, 2026
@Venkaiahbabuneelam Venkaiahbabuneelam added the size:M Code changes between 10-40 lines label Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M Code changes between 10-40 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant